﻿<!DOCTYPE html>
<html>

<head lang="en">
    <title>骡窝日报</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/index.css" rel="stylesheet">
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script>

        $(function () {

            $(".search").click(function () {
                $('.searchBtn').change(function () {
                    var value = $('.searchBtn').val();
                    if (value) {
                        sessionStorage.setItem("keyword", JSON.stringify(value))
                        location.reload();
                    }
                });
            })

            var keyword = JSON.parse(sessionStorage.getItem("keyword"));
            $('.searchBtn').val(keyword)
            $.get("/travels", {keyword: keyword}, function (data) {
                $('.searchInfo').renderValues({list: data.list}, {
                    getHref: function (item, value) {
                        var href = $(item).data("href");
                        $(item).attr("href", href + value);
                    }
                });
                $.get("/strategies", {keyword: keyword}, function (da) {
                    var uu = JSON.parse(sessionStorage.getItem("delete"));
                    if (uu == 1) {
                        $('.searchInfo').html("");
                    }
                    var temp = '<h6 class="news-title">搜索到的攻略.. </h6>';
                    $.each(da.list, function (index, ele) {
                        temp += '<div style="margin-bottom: 20px">\n' +
                            '                <a href="strategyDetails.html?id=' + ele.id + '">\n' +
                            '                    <div class="row news-detail">\n' +
                            '                        <div class="col-5">\n' +
                            '                            <img src="' + ele.coverUrl + '">\n' +
                            '                        </div>\n' +
                            '                        <div class="col-7">\n' +
                            '                            <h4>' + ele.title + '</h4>\n' +
                            '                            <p>' + ele.releaseTime + ' </p>\n' +
                            '                        </div>\n' +
                            '                    </div>\n' +
                            '                </a>\n' +
                            '                <hr>\n' +
                            '            </div>';
                    })
                    if (uu != 3) {
                        $('.searchInfo').append(temp);
                    }
                })
            });

        })
    </script>
</head>

<body>


<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="index.html">
                <span><i class="fa fa-chevron-left fa-2x" style="color: white"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
                <input class="form-control searchBtn" placeholder="搜索资讯">
            </div>
        </div>
    </div>
</div>

<input type="hidden" name="currentPage" id="currentPage" value="1">
<div class="container search">
    <div class="searchInfo">
        <h6 class="news-title">搜索到的游记.. </h6>
        <div render-loop="list">
            <div style="margin-bottom: 20px">
                <a data-href="travelContent.html?id=" render-key="list.id" render-fun="getHref">
                    <div class="row news-detail">
                        <div class="col-5">
                            <img render-src="list.coverUrl">
                        </div>
                        <div class="col-7">
                            <h4 render-html="list.title"></h4>
                            <p render-html="list.travelTime"></p>
                        </div>
                    </div>
                </a>
                <hr>
            </div>

        </div>
    </div>


</div>
</div>


</body>
</html>